import request from "@/utils/request";
import { AxiosPromise } from "axios";
import {
  DictTypePageResult,
  DictTypeForm,
  DictQuery,
  DictForm,
  DictPageResult,
  DictTypePageVO,
} from "./types";

/**
 * 字典类型分页列表
 *
 * @param queryParams
 */
export function getDictTypePage() {
  return request({
    url: '/admin/dictType/getAll',
    method: 'get'
  });
}

export function getDictPage(queryParams: DictQuery): AxiosPromise<DictPageResult> {
  return request({
    url: '/admin/dict/index',
    method: 'get',
    params: queryParams
  })
}


export function delDictType(data: any) {
  return request({
    url: '/admin/dictType/del',
    method: 'delete',
    data
  })
}

export function delDict(data: any) {
  return request({
    url: '/admin/dict/del',
    method: 'delete',
    data
  })
}

export function dictTypeForm(ids: number) {
  return request({
    url: '/admin/dictType/edit',
    method: 'get',
    params: {
      ids: ids
    }
  })
}

export function dictForm(ids: number) {
  return request({
    url: '/admin/dict/edit',
    method: 'get',
    params: {
      ids: ids
    }
  })
}

export function dictUpdate(data:any) {
  return request({
    url: '/admin/dict/edit',
    method: 'post',
    data
  })
}

export function dictCreate(data:any) {
  return request({
    url: '/admin/dict/add',
    method: 'post',
    data
  })
}

export function dictTypeUpdate(data:any) {
  return request({
    url: '/admin/dictType/edit',
    method: 'post',
    data
  })
}

export function dictTypeCreate(data:any) {
  return request({
    url: '/admin/dictType/add',
    method: 'post',
    data
  })
}
